#ifndef PARSER_H
#define PARSER_H


#include <QWidget>
#include <QtGui>
#include <QtNetwork/QNetworkAccessManager>
#include "tnotify.h"
#include "tthread.h"
#include "tthreadlist.h"
#include "tnetworkmanager.h"

class parser : public QWidget
{
    Q_OBJECT
public:
    explicit parser(QWidget *parent = 0);
    static QString getTitleFromReply(QString data);
    static QString toUnicode (QString str);
    static QString getMessageFromReply(QString data);
    void addNotify(void);
    void deleteNotify(void);

protected:
     void closeEvent(QCloseEvent *event);
     void changeEvent(QEvent *event);

private:
    QLineEdit* url;
    QPushButton* addButton;
    QPushButton* deleteButton;
    QPushButton* startAllButton;
    QPushButton* startButton;
    QPushButton* ondemandButton;
    QPushButton* stopButton;
    QPushButton* testButton;
    QPushButton* hideButton;
    QPushButton* exitButton;
    TThreadList* listView;
    QGridLayout* grid;
    TNetworkManager* nm;
    TNotify* notifications;
    int notificationNum;
    QSystemTrayIcon* trayIcon;
    QMenu* trayIconMenu;
    void showTrayIconMenu(void);

signals:
    void requestQuit(void);

public slots:
    void addURL(void);
    void deleteURL(void);

private slots:
    void start(void);
    void startAll(void);
    void stop(void);
    void test(void);
    void trayIconActivated(QSystemTrayIcon::ActivationReason);
};

#endif // PARSER_H
